package com.ttxs.generator.output.java;

import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.ttxs.generator.engine.CustomFreemarker;
import com.ttxs.generator.output.Output;

import java.io.File;
import java.io.IOException;

public class MvcConfig implements Output {

    @Override
    public void write(CustomFreemarker templateEngine) throws IOException {
        if(!templateEngine.formBean().isSpringCloud()) {
            String path = templateEngine.hasModule()
                    ? templateEngine.getCustomParentPath() + File.separator + OutputFile.other
                    : templateEngine.getPathInfo(OutputFile.other);
            File resultJava = new File(path + File.separator + "MvcConfig.java");
            templateEngine.outputFile(resultJava, templateEngine.customMap(), "templates/mvc_config.java.ftl");
        }
    }
}
